package com.kotle.baselib.recyclerview;


import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

/**
 * Created by Administrator on 2017/5/24.
 * 使用dataBinding的RecyclerView的Adapter
 */

public abstract class SimpleNormalRlvAdapter<T extends BaseViewHolder> extends RecyclerView.Adapter<T> {
    private int resId;

    public SimpleNormalRlvAdapter(int layoutResId) {
        this.resId = layoutResId;
    }

    @Override
    public T onCreateViewHolder(ViewGroup parent, int viewType) {
        View inflate = LayoutInflater.from(parent.getContext()).inflate(this.resId, parent, false);
        return onCreateViewHolder(inflate);
    }

    abstract protected T onCreateViewHolder(View itemView);

    @Override
    abstract public void onBindViewHolder(T holder, int position);

    @Override
    abstract public int getItemCount();

}
